<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function createClass(flag = true) {
        if (flag) {
          return class {
            constructor() {
              this.title = "class1";
            }
          };
        } else {
          return class {
            constructor() {
              this.title = "class2";
            }
          };
        }
      }
      const C1 = createClass(true);
      const C2 = createClass(false);
      console.log(new (createClass(true))().title);
      // console.log(new C1().title);
      // console.log(new C2().title);
      // console.log(createClass(true));
      // console.log(createClass(false));
    </script>
  </body>
</html>
